<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 工厂模式是用来批量创建对象的
        function newObj (name, age) {
            var o = new Object()
            o.name = name
            o.age = age
            return o
        }
        // 直接调用工厂函数就可以得到对象了，这里不需要new
        var obj1 = newObj('张三', 18)
        var obj2 = newObj('小明', 80)


    </script>
</body>
</html>